Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warning for collections #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shepherdjay
Copy link

@shepherdjay shepherdjay commented Apr 27, 2020

Resolves this error

flask_nav\__init__.py:49: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    class ElementRegistry(collections.MutableMapping):

Edit: Fixes #28

@sbraz
Copy link

sbraz commented Aug 6, 2021

The warning is an error in Python 3.10, could someone please merge this and make a new release?

ERROR tests/test_flasknav.py - AttributeError: module 'collections' has no attribute 'MutableMapping'                                                                                                              

@sbraz
Copy link

sbraz commented Aug 6, 2021

@shepherdjay I just noticed you also need to change the import or the module won't work:

diff --git a/flask_nav/__init__.py b/flask_nav/__init__.py
index 7c25dfa..5826b9e 100644
--- a/flask_nav/__init__.py
+++ b/flask_nav/__init__.py
@@ -1,4 +1,4 @@
-import collections
+import collections.abc
 from importlib import import_module
 import re
 
@@ -46,7 +46,7 @@ class NavbarRenderingError(Exception):
     pass
 
 
-class ElementRegistry(collections.MutableMapping):
+class ElementRegistry(collections.abc.MutableMapping):
     def __init__(self):
         self._elems = {}
 

@shepherdjay
Copy link
Author

@sbraz - Updated - sorry did not see your earlier comment been in the middle of a move.

@GarfieldTheFirst
Copy link

Would it be possible to merge and release a new version? Ran into this issue as well and fixed it in analogous way locally. Would be very nice :).

@Rachelonline
Copy link

Yes, please merge this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError on Python 3.10
5 participants